package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

@Setter@Getter
public class HotelCatalog extends BaseDomain{

    private static final int WORK_IN = 0;  //营业中
    private static final int WORK_OUT = 1;  //未营业


    private static final int RECOMMEND_NO = 3;  //不推荐
    private static final int RECOMMEND_YES = 4;  //推荐
    private static final int RECOMMEND_SUPER = 5;  //极力推荐


    private String name;   //酒店名称

    private String coverUrl;  //封面

    private Hotel hotel;  //连锁酒店名称

    private Integer squence;   //序号

    private Integer state = WORK_IN;   //状态:营业中

    private Region place;  //地区

    private HotelContent hotelContent;

    private Integer type=RECOMMEND_YES;//酒店推荐指数

    private Double price;//酒店价格



    public String getTypeName(){
        String msg = "";
        if(type == RECOMMEND_NO){
            msg = "不推荐";
        }else if(type == RECOMMEND_YES){
            msg = "推荐";
        }else if(type == RECOMMEND_SUPER){
            msg = "极力推荐";
        }
        return msg;
    }

    public String getStateName(){
        String msg = "营业中";
        if(state == WORK_OUT){
            msg = "未营业";
        }
        return msg;
    }

    public String getJson(){
        Map map = new HashMap();
        map.put("id",id);
        map.put("name",name);
        map.put("coverUrl",coverUrl);
        map.put("squence",squence);
        map.put("state",state);
        if(hotel != null){
            map.put("hotelId",hotel.getId());
            map.put("hotelName",hotel.getName());
        }
        if(place != null){
            map.put("placeId",place.getId());
            map.put("placeName",place.getName());
        }
        return JSONUtil.toJSONString(map);
    }
}